/**
 * output package name
 */
package com.kingdee.eas.custom.bscc.report.client;

import java.awt.event.*;
import org.apache.log4j.Logger;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIException;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.framework.*;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.kdf.form.Page;
import com.kingdee.bos.ctrl.kdf.headfootdesigner.HeadFootModel;
import com.kingdee.bos.ctrl.kdf.headfootdesigner.HeadFootParser;
import com.kingdee.bos.ctrl.kdf.table.*;
import com.kingdee.bos.ctrl.kdf.table.print.*;
import com.kingdee.bos.ctrl.kdf.util.style.StyleAttributes;
import com.kingdee.bos.ctrl.kdf.util.style.Styles;
import com.kingdee.bos.ctrl.swing.*;
import com.kingdee.bos.ctrl.swing.tree.DefaultKingdeeTreeNode;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.dao.query.IQueryExecutor;
import com.kingdee.bos.dao.query.QueryExecutorFactory;
import com.kingdee.bos.metadata.entity.*;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.*;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.core.fm.ContextHelperFactory;
import com.kingdee.eas.base.core.util.EmptyUtil;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.basedata.assistant.*;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.*;
import com.kingdee.eas.fi.cas.client.AbstractCasSubsidiaryLedgerHandler;
import com.kingdee.eas.fi.cas.client.CasSubsidiaryLedgerFilterParam;
import com.kingdee.eas.fi.cas.client.ClientUtils;
import com.kingdee.eas.fm.common.*;
import com.kingdee.eas.fm.common.client.FMClientHelper;
import com.kingdee.eas.fm.common.client.FMFilterBaseUI;
import com.kingdee.eas.fm.fs.*;
import com.kingdee.eas.fm.fs.client.*;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import java.awt.event.ActionEvent;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.*;
import java.util.prefs.Preferences;
import javax.swing.KeyStroke;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import org.apache.log4j.Logger;

/**
 * output class name
 */
public class CasSubsidiaryLedgerUI extends AbstractCasSubsidiaryLedgerUI
{
    private static final Logger logger = CoreUIObject.getLogger(CasSubsidiaryLedgerUI.class);
    
    public CasSubsidiaryLedgerUI()
    throws Exception
{
/* <-MISALIGNED-> */ /* 101*/        resourcePath = "com.kingdee.eas.fm.fs.client.SubsidiaryLedgerResource";
/* <-MISALIGNED-> */ /* 115*/        tablePrint = null;
/* <-MISALIGNED-> */ /* 521*/        refreshTree = false;
/* <-MISALIGNED-> */ /* 752*/        doPrint = new Runnable() {
        public void run()
        {
/* <-MISALIGNED-> */ /* 754*/                if(multiPrint != null)
/* <-MISALIGNED-> */ /* 755*/                    multiPrint.preview();
        }
        final CasSubsidiaryLedgerUI this$0;
        
        {
/* <-MISALIGNED-> */ /* 753*/                this$0 = CasSubsidiaryLedgerUI.this;
///* <-MISALIGNED-> */ /* 753*/                super();
        }
}
;
/* <-MISALIGNED-> */ /* 119*/        tablePrint = new KDTable();
}
    class DoPrintThreadPre extends Thread
    {
                public void run()
                {
/* 740*/            if(multiPrint != null)
/* 741*/                if(!doPrint)
/* 742*/                    multiPrint.preview();

/* 744*/                else/* 744*/                    multiPrint.print();
                }
                private MultiPrint multiPrint;
                private boolean doPrint;
                final CasSubsidiaryLedgerUI this$0;
                public DoPrintThreadPre(MultiPrint multiPrint, boolean doPrint)
                {
/* <-MISALIGNED-> */ /* 734*/            this$0 = CasSubsidiaryLedgerUI.this;
///* <-MISALIGNED-> */ /* 734*/            super();
/* <-MISALIGNED-> */ /* 735*/            this.multiPrint = multiPrint;
/* <-MISALIGNED-> */ /* 736*/            this.doPrint = doPrint;
                }
    }
    public void onShow()
    throws Exception
{
/* <-MISALIGNED-> */ /* 125*/        super.onShow();
/* <-MISALIGNED-> */ /* 126*/        treeList.requestFocus();
}
    protected void execQuery()
    throws BOSException
{
/* <-MISALIGNED-> */ /* 133*/        CasSubsidiaryLedgerFilterParam param = (CasSubsidiaryLedgerFilterParam)getFilterParam();
/* <-MISALIGNED-> */ /* 134*/        AbstractCasSubsidiaryLedgerHandler handler = new AbstractCasSubsidiaryLedgerHandler();
/* <-MISALIGNED-> */ /* 136*/        String datePeriod = "";
/* <-MISALIGNED-> */ /* 137*/        if(!param.isByDay())
    {
/* <-MISALIGNED-> */ /* 139*/            String args[] = {
/* <-MISALIGNED-> */ /* 139*/                String.valueOf(param.getBeginYear()), String.valueOf(param.getBeginMonth()), String.valueOf(param.getEndYear()), String.valueOf(param.getEndMonth())
        };
/* <-MISALIGNED-> */ /* 144*/            MessageFormat mf = new MessageFormat(EASResource.getString("com.kingdee.eas.fi.cas.CasResources", "LBL_PeriodRange"));
/* <-MISALIGNED-> */ /* 145*/            datePeriod = mf.format(args);
    } else
    {
/* <-MISALIGNED-> */ /* 149*/            datePeriod = (new StringBuilder()).append(FMConstants.FORMAT_DAY.format(param.getFromDate())).append(" - ").append(FMConstants.FORMAT_DAY.format(param.getToDate())).toString();
    }
/* <-MISALIGNED-> */ /* 152*/        txtPeriodRange.setText(datePeriod);
/* <-MISALIGNED-> */ /* 154*/        tblMain.checkParsed();
/* <-MISALIGNED-> */ /* 155*/        tblMain.getStyleAttributes().setLocked(true);
/* <-MISALIGNED-> */ /* 156*/        tblMain.getSelectManager().setSelectMode(10);
/* <-MISALIGNED-> */ /* 159*/        try
    {
/* <-MISALIGNED-> */ /* 159*/            handler.initTree(treeList, param);
    }
/* <-MISALIGNED-> */ /* 160*/        catch(EASBizException e)
    {
/* <-MISALIGNED-> */ /* 161*/            logger.error(e);
/* <-MISALIGNED-> */ /* 162*/            SysUtil.abort();
    }
/* <-MISALIGNED-> */ /* 165*/        DefaultKingdeeTreeNode node = null;
/* <-MISALIGNED-> */ /* 166*/        node = (DefaultKingdeeTreeNode)getUIContext().get("DefaultTreeNode");
/* <-MISALIGNED-> */ /* 168*/        if(node != null)
    {
/* <-MISALIGNED-> */ /* 169*/            setSelectionNode(node);
/* <-MISALIGNED-> */ /* 170*/            getUIContext().put("DefaultTreeNode", null);
    } else
    {
/* <-MISALIGNED-> */ /* 172*/            FSClientHelper.setFirstInnerAcctNodeSelected(treeList);
    }
}
private void setSelectionNode(DefaultKingdeeTreeNode node)
{
/* <-MISALIGNED-> */ /* 180*/        InnerAccountInfo sumInner = (InnerAccountInfo)node.getUserObject();
/* <-MISALIGNED-> */ /* 181*/        int height = treeList.getRowCount();
/* <-MISALIGNED-> */ /* 182*/        for(int i = 1; i < height; i++)
    {
/* <-MISALIGNED-> */ /* 183*/            TreePath tp = treeList.getPathForRow(i);
/* <-MISALIGNED-> */ /* 184*/            if(tp != null)
        {
/* <-MISALIGNED-> */ /* 188*/                DefaultKingdeeTreeNode tn = (DefaultKingdeeTreeNode)tp.getLastPathComponent();
/* <-MISALIGNED-> */ /* 190*/                setSelectionNode(sumInner.getId().toString(), tn);
        }
    }
}
private void setSelectionNode(String srcInnerAcctId, DefaultKingdeeTreeNode node)
{
/* <-MISALIGNED-> */ /* 214*/        boolean isMatched = false;
/* <-MISALIGNED-> */ /* 215*/        if(node.isLeaf())
    {
/* <-MISALIGNED-> */ /* 216*/            Object obj = node.getUserObject();
/* <-MISALIGNED-> */ /* 217*/            if(obj instanceof InnerAccountInfo)
        {
/* <-MISALIGNED-> */ /* 218*/                InnerAccountInfo info = (InnerAccountInfo)obj;
/* <-MISALIGNED-> */ /* 219*/                if(srcInnerAcctId.equals(info.getId().toString()))
            {
/* <-MISALIGNED-> */ /* 220*/                    treeList.setSelectionNode(node);
/* <-MISALIGNED-> */ /* 221*/                    isMatched = true;
/* <-MISALIGNED-> */ /* 222*/                    return;
            }
        }
    }
/* <-MISALIGNED-> */ /* 226*/        int childCount = node.getChildCount();
/* <-MISALIGNED-> */ /* 228*/        for(int i = 0; i < childCount && !isMatched; i++)
    {
/* <-MISALIGNED-> */ /* 232*/            DefaultKingdeeTreeNode childNode = (DefaultKingdeeTreeNode)node.getChildAt(i);
/* <-MISALIGNED-> */ /* 234*/            setSelectionNode(srcInnerAcctId, childNode);
    }
}
public void parseAcctNumber(StringBuffer acctNumber, DefaultKingdeeTreeNode node)
{
/* <-MISALIGNED-> */ /* 243*/        int childCount = node.getChildCount();
/* <-MISALIGNED-> */ /* 244*/        if(childCount == 0)
/* <-MISALIGNED-> */ /* 245*/            return;
/* <-MISALIGNED-> */ /* 249*/        for(int j = 0; j < childCount; j++)
    {
/* <-MISALIGNED-> */ /* 250*/            DefaultKingdeeTreeNode childNode = (DefaultKingdeeTreeNode)treeList.getModel().getChild(node, j);
/* <-MISALIGNED-> */ /* 253*/            if(childNode.getUserObject() instanceof InnerAccountInfo)
        {
/* <-MISALIGNED-> */ /* 254*/                InnerAccountInfo innerAcct = (InnerAccountInfo)childNode.getUserObject();
/* <-MISALIGNED-> */ /* 255*/                if(acctNumber.length() == 0)
            {
/* <-MISALIGNED-> */ /* 256*/                    acctNumber.append(innerAcct.getNumber());
            } else
            {
/* <-MISALIGNED-> */ /* 258*/                    acctNumber.append(",");
/* <-MISALIGNED-> */ /* 259*/                    acctNumber.append(innerAcct.getNumber());
            }
/* <-MISALIGNED-> */ /* 261*/                continue;
        }
/* <-MISALIGNED-> */ /* 263*/            if(childNode.getUserObject() instanceof AccountBankInfo)
        {
/* <-MISALIGNED-> */ /* 264*/                AccountBankInfo bankAcct = (AccountBankInfo)childNode.getUserObject();
/* <-MISALIGNED-> */ /* 265*/                if(acctNumber.length() == 0)
            {
/* <-MISALIGNED-> */ /* 266*/                    acctNumber.append(bankAcct.getNumber());
            } else
            {
/* <-MISALIGNED-> */ /* 268*/                    acctNumber.append(",");
/* <-MISALIGNED-> */ /* 269*/                    acctNumber.append(bankAcct.getNumber());
            }
/* <-MISALIGNED-> */ /* 271*/                continue;
        }
/* <-MISALIGNED-> */ /* 272*/            for(int k = 0; k < node.getChildCount(); k++)
/* <-MISALIGNED-> */ /* 273*/                parseAcctNumber(acctNumber, (DefaultKingdeeTreeNode)node.getChildAt(k));
    }
}
public FMFilterBaseUI getFilterUI()
    throws Exception
{
/* <-MISALIGNED-> */ /* 287*/        if(filterUI == null)
/* <-MISALIGNED-> */ /* 288*/            filterUI = new CasSubsidiaryLedgerFilterUI();
/* <-MISALIGNED-> */ /* 291*/        return filterUI;
}
protected void treeList_valueChanged(TreeSelectionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 298*/        super.treeList_valueChanged(e);
/* <-MISALIGNED-> */ /* 303*/        fillTableData();
/* <-MISALIGNED-> */ /* 305*/        balanceMap = null;
}
private void fillTableData()
    throws EASBizException, BOSException, SQLException
{
/* <-MISALIGNED-> */ /* 315*/        tblMain.removeRows();
/* <-MISALIGNED-> */ /* 317*/        TreePath path = treeList.getSelectionPath();
/* <-MISALIGNED-> */ /* 318*/        if(path == null)
/* <-MISALIGNED-> */ /* 319*/            return;
/* <-MISALIGNED-> */ /* 322*/        DefaultKingdeeTreeNode node = (DefaultKingdeeTreeNode)path.getLastPathComponent();
/* <-MISALIGNED-> */ /* 324*/        if(node == null)
/* <-MISALIGNED-> */ /* 325*/            return;
/* <-MISALIGNED-> */ /* 332*/        Object obj = node.getUserObject();
/* <-MISALIGNED-> */ /* 333*/        if(obj == null)
    {
/* <-MISALIGNED-> */ /* 334*/            tblMain.removeRows();
/* <-MISALIGNED-> */ /* 335*/            return;
    }
/* <-MISALIGNED-> */ /* 338*/        String acctNumbers = "";
/* <-MISALIGNED-> */ /* 340*/        if(obj != null && (obj instanceof InnerAccountInfo))
    {
/* <-MISALIGNED-> */ /* 341*/            InnerAccountInfo innerAcct = (InnerAccountInfo)obj;
/* <-MISALIGNED-> */ /* 342*/            acctNumbers = innerAcct.getNumber();
    }
/* <-MISALIGNED-> */ /* 346*/        if(obj != null && (obj instanceof CompanyOrgUnitInfo))
    {
/* <-MISALIGNED-> */ /* 347*/            StringBuffer sb = new StringBuffer();
/* <-MISALIGNED-> */ /* 348*/            parseAcctNumber(sb, node);
/* <-MISALIGNED-> */ /* 349*/            acctNumbers = sb.toString();
    }
/* <-MISALIGNED-> */ /* 351*/        if(obj != null && (obj instanceof AccountBankPropertyEnum))
    {
/* <-MISALIGNED-> */ /* 352*/            StringBuffer sb = new StringBuffer();
/* <-MISALIGNED-> */ /* 353*/            parseAcctNumber(sb, node);
/* <-MISALIGNED-> */ /* 354*/            acctNumbers = sb.toString();
    }
/* <-MISALIGNED-> */ /* 357*/        if(obj != null && (obj instanceof AccountPropertyInfo))
    {
/* <-MISALIGNED-> */ /* 358*/            StringBuffer sb = new StringBuffer();
/* <-MISALIGNED-> */ /* 359*/            parseAcctNumber(sb, node);
/* <-MISALIGNED-> */ /* 360*/            acctNumbers = sb.toString();
    }
/* <-MISALIGNED-> */ /* 364*/        if(acctNumbers == null || acctNumbers.trim().length() == 0)
    {
/* <-MISALIGNED-> */ /* 365*/            return;
    } else
    {
/* <-MISALIGNED-> */ /* 368*/            fillTable(tblMain, acctNumbers);
/* <-MISALIGNED-> */ /* 369*/            return;
    }
}
private void fillTable(KDTable table, String acctNumbers)
    throws BOSException, EASBizException, SQLException
{
/* <-MISALIGNED-> */ /* 373*/        Set acctSet = new HashSet();
/* <-MISALIGNED-> */ /* 374*/        if(acctNumbers.indexOf(",") == -1)
    {
/* <-MISALIGNED-> */ /* 375*/            acctSet.add(acctNumbers);
    } else
    {
/* <-MISALIGNED-> */ /* 377*/            String acctArray[] = acctNumbers.split(",");
/* <-MISALIGNED-> */ /* 378*/            for(int i = 0; i < acctArray.length; i++)
/* <-MISALIGNED-> */ /* 379*/                acctSet.add(acctArray[i]);
    }
/* <-MISALIGNED-> */ /* 384*/        CompanyOrgUnitInfo chCompany = ContextHelperFactory.getRemoteInstance().getCurrentCompany();
/* <-MISALIGNED-> */ /* 387*/        BOSUuid currencyId = null;
/* <-MISALIGNED-> */ /* 388*/        EntityViewInfo ev = (EntityViewInfo)mainQuery.clone();
/* <-MISALIGNED-> */ /* 389*/        FilterInfo filter = ev.getFilter();
/* <-MISALIGNED-> */ /* 391*/        CurrencyInfo currency = (CurrencyInfo)cboCurrency.getSelectedItem();
/* <-MISALIGNED-> */ /* 392*/        currencyId = currency.getId();
/* <-MISALIGNED-> */ /* 393*/        filter.getFilterItems().add(new FilterItemInfo("currency.id", currencyId));
/* <-MISALIGNED-> */ /* 395*/        filter.getFilterItems().add(new FilterItemInfo("innerAccount.number", acctSet, CompareType.INCLUDE));
/* <-MISALIGNED-> */ /* 409*/        SorterItemCollection sorter = ev.getSorter();
/* <-MISALIGNED-> */ /* 410*/        sorter.add(new SorterItemInfo("company.id"));
/* <-MISALIGNED-> */ /* 411*/        sorter.add(new SorterItemInfo("date"));
/* <-MISALIGNED-> */ /* 415*/        sorter.add(new SorterItemInfo("createTime"));
/* <-MISALIGNED-> */ /* 416*/        sorter.add(new SorterItemInfo("seq"));
/* <-MISALIGNED-> */ /* 417*/        sorter.add(new SorterItemInfo("billNumber"));
/* <-MISALIGNED-> */ /* 419*/        IQueryExecutor exec = QueryExecutorFactory.getRemoteInstance(mainQueryPK);
/* <-MISALIGNED-> */ /* 421*/        exec.setObjectView(ev);
/* <-MISALIGNED-> */ /* 422*/        com.kingdee.jdbc.rowset.IRowSet rs = exec.executeQuery();
/* <-MISALIGNED-> */ /* 424*/        SubsidiaryLedgerFilterParam param = (SubsidiaryLedgerFilterParam)getFilterParam();
/* <-MISALIGNED-> */ /* 426*/        AbstractCasSubsidiaryLedgerHandler handler = new AbstractCasSubsidiaryLedgerHandler();
/* <-MISALIGNED-> */ /* 428*/        handler.fillData3(mainQueryPK, table, rs, param, chCompany.getNumber(), currencyId, acctNumbers);
}
protected void cboCurrency_actionPerformed(ActionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 509*/        super.cboCurrency_actionPerformed(e);
/* <-MISALIGNED-> */ /* 510*/        treeList_valueChanged(null);
}
private void checkClearHourse()
    throws Exception
{
/* <-MISALIGNED-> */ /* 517*/        FSClientHelper.checkClearingHouseCompany();
}
public void onLoad()
    throws Exception
{
/* <-MISALIGNED-> */ /* 524*/        CompanyOrgUnitInfo company = ContextHelperFactory.getRemoteInstance().getCurrentCompany();
/* <-MISALIGNED-> */ /* 535*/        if(!"FINDVIEW".equalsIgnoreCase(getOprtState()))
/* <-MISALIGNED-> */ /* 537*/            ClientUtils.checkCompany(this, company);
/* <-MISALIGNED-> */ /* 540*/        treeView.setShowControlPanel(true);
/* <-MISALIGNED-> */ /* 544*/        FMClientHelper.initCurrency(cboCurrency);
/* <-MISALIGNED-> */ /* 547*/        Object currency = getUIContext().get("currency");
/* <-MISALIGNED-> */ /* 548*/        if(currency != null)
/* <-MISALIGNED-> */ /* 549*/            cboCurrency.setSelectedItem(currency);
/* <-MISALIGNED-> */ /* 551*/        else
/* <-MISALIGNED-> */ /* 551*/            FMClientHelper.setSelectObject(cboCurrency, ContextHelperFactory.getRemoteInstance().getCompanyBaseCurrency(company));
/* <-MISALIGNED-> */ /* 555*/        super.onLoad();
/* <-MISALIGNED-> */ /* 565*/        Preferences pref = Preferences.userNodeForPackage(getClass());
/* <-MISALIGNED-> */ /* 566*/        isPrintAll = pref.getBoolean("isPrintAll", false);
/* <-MISALIGNED-> */ /* 568*/        isPaging = pref.getBoolean("isPaging", true);
/* <-MISALIGNED-> */ /* 570*/        HeadFootModel model = new HeadFootModel();
/* <-MISALIGNED-> */ /* 571*/        model.addRow(" &| ");
/* <-MISALIGNED-> */ /* 572*/        model.addRow(" &| ");
/* <-MISALIGNED-> */ /* 573*/        model.addRow(" &| ");
/* <-MISALIGNED-> */ /* 574*/        model.addRow(" &| ");
/* <-MISALIGNED-> */ /* 575*/        tablePrint.getPrintManager().setHeader(HeadFootParser.parseModel2HeadFootPage(model));
/* <-MISALIGNED-> */ /* 578*/        refreshTree = true;
/* <-MISALIGNED-> */ /* 580*/        menuItemCalculator.setAccelerator(KeyStroke.getKeyStroke("ctrl shift F12"));
}
public static void showSubsidiaryLedgerUI(IUIObject ui, SubsidiaryLedgerFilterParam param, DefaultKingdeeTreeNode node, CurrencyInfo curInfo)
    throws UIException
{
/* <-MISALIGNED-> */ /* 590*/        UIContext uiContext = new UIContext(ui);
/* <-MISALIGNED-> */ /* 592*/        uiContext.put("isDirectShow", Boolean.TRUE);
/* <-MISALIGNED-> */ /* 594*/        uiContext.put("filterParam", param);
/* <-MISALIGNED-> */ /* 595*/        uiContext.put("DefaultTreeNode", node);
/* <-MISALIGNED-> */ /* 596*/        uiContext.put("currency", curInfo);
/* <-MISALIGNED-> */ /* 599*/        IUIWindow uiWindow = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UINewTabFactory").create("com.kingdee.eas.custom.bscc.report.client.CasSubsidiaryLedgerUI", uiContext, null, OprtState.VIEW);
/* <-MISALIGNED-> */ /* 602*/        uiWindow.show();
}
protected void initWorkButton()
{
/* <-MISALIGNED-> */ /* 613*/        super.initWorkButton();
/* <-MISALIGNED-> */ /* 615*/        actionViewSettlementBill.putValue("SmallIcon", EASResource.getIcon("imgTbtn_linkviewbill"));
/* <-MISALIGNED-> */ /* 618*/        actionPrintSetting.putValue("SmallIcon", EASResource.getIcon("imgTbtn_distributelog"));
}
public void actionViewSettlementBill_actionPerformed(ActionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 630*/        checkSelected();
/* <-MISALIGNED-> */ /* 631*/        int i = tblMain.getSelectManager().getActiveRowIndex();
/* <-MISALIGNED-> */ /* 633*/        String id = (String)tblMain.getRow(i).getCell("id").getValue();
/* <-MISALIGNED-> */ /* 634*/        if(FMHelper.isEmpty(id))
    {
/* <-MISALIGNED-> */ /* 635*/            MsgBox.showInfo(this, EASResource.getString(resourcePath, "SelectValidRecord"));
/* <-MISALIGNED-> */ /* 637*/            return;
    }
/* <-MISALIGNED-> */ /* 639*/        SubsidiaryLedgerInfo info = SubsidiaryLedgerFactory.getRemoteInstance().getSubsidiaryLedgerInfo(new ObjectUuidPK(BOSUuid.read(id)));
/* <-MISALIGNED-> */ /* 642*/        BOSUuid bosUuid = info.getBillId();
/* <-MISALIGNED-> */ /* 643*/        if(bosUuid == null)
    {
/* <-MISALIGNED-> */ /* 644*/            MsgBox.showInfo(this, EASResource.getString(resourcePath, "SelectValidRecord"));
/* <-MISALIGNED-> */ /* 646*/            return;
    }
/* <-MISALIGNED-> */ /* 648*/        String billId = bosUuid.toString();
/* <-MISALIGNED-> */ /* 649*/        if(billId != null)
/* <-MISALIGNED-> */ /* 650*/            FMClientHelper.viewDetailBill(this, billId, info.getCompany());
}
protected KDTable getMainTable()
{
/* <-MISALIGNED-> */ /* 661*/        return tblMain;
}
protected void preparePrintPageHeader(HeadFootModel headerModel)
{
/* <-MISALIGNED-> */ /* 670*/        TreePath path = treeList.getSelectionPath();
/* <-MISALIGNED-> */ /* 671*/        if(path == null)
/* <-MISALIGNED-> */ /* 672*/            return;
/* <-MISALIGNED-> */ /* 675*/        DefaultKingdeeTreeNode node = (DefaultKingdeeTreeNode)path.getLastPathComponent();
/* <-MISALIGNED-> */ /* 677*/        if(node == null)
/* <-MISALIGNED-> */ /* 678*/            return;
/* <-MISALIGNED-> */ /* 680*/        if(node.isRoot())
/* <-MISALIGNED-> */ /* 681*/            return;
/* <-MISALIGNED-> */ /* 683*/        Object obj = node.getUserObject();
/* <-MISALIGNED-> */ /* 684*/        if(obj == null)
/* <-MISALIGNED-> */ /* 685*/            return;
/* <-MISALIGNED-> */ /* 687*/        String inAcctString = "";
/* <-MISALIGNED-> */ /* 689*/        if(obj != null && (obj instanceof CompanyOrgUnitInfo))
/* <-MISALIGNED-> */ /* 690*/            return;
/* <-MISALIGNED-> */ /* 692*/        if(obj != null && (obj instanceof AccountBankPropertyEnum))
/* <-MISALIGNED-> */ /* 693*/            return;
/* <-MISALIGNED-> */ /* 696*/        if(obj != null && (obj instanceof InnerAccountInfo))
    {
/* <-MISALIGNED-> */ /* 697*/            InnerAccountInfo innerAcct = (InnerAccountInfo)obj;
/* <-MISALIGNED-> */ /* 698*/            inAcctString = (new StringBuilder()).append(innerAcct.getNumber()).append("-").append(innerAcct.getName()).toString();
    }
/* <-MISALIGNED-> */ /* 701*/        if(inAcctString == null)
    {
/* <-MISALIGNED-> */ /* 702*/            return;
    } else
    {
/* <-MISALIGNED-> */ /* 704*/            String headString = inAcctString;
/* <-MISALIGNED-> */ /* 705*/            headerModel.addRow(headString, Styles.getDefaultSA());
/* <-MISALIGNED-> */ /* 706*/            super.preparePrintPageHeader(headerModel);
/* <-MISALIGNED-> */ /* 707*/            return;
    }
}
public void actionPrint_actionPerformed(ActionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 710*/        initMultiPrint();
/* <-MISALIGNED-> */ /* 714*/        DoPrintThreadPre doP = new DoPrintThreadPre(multiPrint, true);
/* <-MISALIGNED-> */ /* 715*/        doP.start();
}
public void actionPrintPre_actionPerformed(ActionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 720*/        initMultiPrint();
/* <-MISALIGNED-> */ /* 724*/        DoPrintThreadPre doP = new DoPrintThreadPre(multiPrint, false);
/* <-MISALIGNED-> */ /* 725*/        doP.start();
}
public void actionPrintSetting_actionPerformed(ActionEvent e)
    throws Exception
{
/* <-MISALIGNED-> */ /* 763*/        UIContext uiCtx = new UIContext(this);
/* <-MISALIGNED-> */ /* 764*/        uiCtx.put("Owner", this);
/* <-MISALIGNED-> */ /* 765*/        IUIWindow printSetUI = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UIModelDialogFactory").create("com.kingdee.eas.fm.fs.client.SubsidiaryPrintSettingUI", uiCtx);
/* <-MISALIGNED-> */ /* 767*/        printSetUI.show();
/* <-MISALIGNED-> */ /* 768*/        SubsidiaryPrintSettingUI printSetUIObj = (SubsidiaryPrintSettingUI)printSetUI.getUIObject();
/* <-MISALIGNED-> */ /* 770*/        if(printSetUIObj.isOK())
    {
/* <-MISALIGNED-> */ /* 771*/            isPrintAll = printSetUIObj.isPrintAll();
/* <-MISALIGNED-> */ /* 772*/            isPaging = printSetUIObj.isPaging();
    }
}
protected Page getHeader(boolean isPaging, InnerAccountInfo innerAcctInfo)
{
/* <-MISALIGNED-> */ /* 777*/        HeadFootModel header = new HeadFootModel();
/* <-MISALIGNED-> */ /* 780*/        StyleAttributes saMajorTitle = Styles.getDefaultSA();
/* <-MISALIGNED-> */ /* 781*/        saMajorTitle.setFontSize(14);
/* <-MISALIGNED-> */ /* 782*/        saMajorTitle.setBold(true);
/* <-MISALIGNED-> */ /* 783*/        header.addRow(getPrintPageTitle(), saMajorTitle);
/* <-MISALIGNED-> */ /* 784*/        header.addRow("");
/* <-MISALIGNED-> */ /* 787*/        StringBuffer headStringOne = new StringBuffer();
/* <-MISALIGNED-> */ /* 793*/        headStringOne.append(lblPeriodRange.getBoundLabelText()).append(" ").append(txtPeriodRange.getText()).append("&|");
/* <-MISALIGNED-> */ /* 797*/        headStringOne.append(lblCurrency.getBoundLabelText()).append(" ").append(cboCurrency.getSelectedItem().toString());
/* <-MISALIGNED-> */ /* 800*/        header.addRow(headStringOne.toString());
/* <-MISALIGNED-> */ /* 802*/        StringBuffer headStringTwo = new StringBuffer();
/* <-MISALIGNED-> */ /* 804*/        if(innerAcctInfo != null)
    {
/* <-MISALIGNED-> */ /* 805*/            innerAcctInfo.setDisplayFormat("$number$-$name$");
/* <-MISALIGNED-> */ /* 806*/            headStringTwo.append(EASResource.getString("com.kingdee.eas.fm.fs.client.SubsidiaryLedgerResource.InnerAccount")).append("   ").append(innerAcctInfo).append("&|");
/* <-MISALIGNED-> */ /* 812*/            headStringTwo.append(" ").append("&|").append(" ");
/* <-MISALIGNED-> */ /* 814*/            header.addRow(headStringTwo.toString());
    }
/* <-MISALIGNED-> */ /* 817*/        Page hPage = HeadFootParser.parseModel2HeadFootPage(header);
/* <-MISALIGNED-> */ /* 818*/        return hPage;
}
protected Page getFooter()
{
/* <-MISALIGNED-> */ /* 822*/        HeadFootModel footer = new HeadFootModel();
/* <-MISALIGNED-> */ /* 823*/        String dateString = (new StringBuilder()).append(EASResource.getString((new StringBuilder()).append("com.kingdee.eas.framework.FrameWorkResource.").append(printDateMsg).toString())).append("&[Date]").toString();
/* <-MISALIGNED-> */ /* 827*/        String personString = (new StringBuilder()).append(EASResource.getString((new StringBuilder()).append("com.kingdee.eas.framework.FrameWorkResource.").append(printPersonMsg).toString())).append(SysContext.getSysContext().getCurrentUserInfo().getName()).toString();
/* <-MISALIGNED-> */ /* 830*/        String pageNumber = (new StringBuilder()).append(EASResource.getString((new StringBuilder()).append("com.kingdee.eas.framework.FrameWorkResource.").append(printPageCountMsg).toString())).append("&[Page]/&[PageCount]").toString();
/* <-MISALIGNED-> */ /* 834*/        String footerString = (new StringBuilder()).append(dateString).append("&|").append(personString).append("&|").append(pageNumber).toString();
/* <-MISALIGNED-> */ /* 836*/        StyleAttributes sb = Styles.getDefaultSA();
/* <-MISALIGNED-> */ /* 837*/        footer.addRow(footerString, sb);
/* <-MISALIGNED-> */ /* 838*/        Page fPage = HeadFootParser.parseModel2HeadFootPage(footer);
/* <-MISALIGNED-> */ /* 839*/        return fPage;
}
protected static InnerAccountCollection getLeafInnerAccounts(TreePath path)
{
/* <-MISALIGNED-> */ /* 844*/        DefaultKingdeeTreeNode node = (DefaultKingdeeTreeNode)path.getLastPathComponent();
/* <-MISALIGNED-> */ /* 846*/        InnerAccountCollection coll = getLeafInnerAccounts(null, node);
/* <-MISALIGNED-> */ /* 847*/        return coll;
}
private static InnerAccountCollection getLeafInnerAccounts(InnerAccountCollection coll, DefaultKingdeeTreeNode node)
{
/* <-MISALIGNED-> */ /* 852*/        if(coll == null)
/* <-MISALIGNED-> */ /* 853*/            coll = new InnerAccountCollection();
/* <-MISALIGNED-> */ /* 855*/        if(node.isLeaf() && (node.getUserObject() instanceof InnerAccountInfo))
    {
/* <-MISALIGNED-> */ /* 856*/            coll.add((InnerAccountInfo)node.getUserObject());
    } else
    {
/* <-MISALIGNED-> */ /* 858*/            int i = 0;
/* <-MISALIGNED-> */ /* 858*/            for(int n = node.getChildCount(); i < n; i++)
        {
/* <-MISALIGNED-> */ /* 859*/                DefaultKingdeeTreeNode leafNode = (DefaultKingdeeTreeNode)node.getChildAt(i);
/* <-MISALIGNED-> */ /* 861*/                getLeafInnerAccounts(coll, leafNode);
        }
    }
/* <-MISALIGNED-> */ /* 868*/        return coll;
}
protected InnerAccountCollection getSelectedInnerAccounts()
{
/* <-MISALIGNED-> */ /* 872*/        InnerAccountCollection innerAcctColl = new InnerAccountCollection();
/* <-MISALIGNED-> */ /* 873*/        TreePath paths[] = treeList.getSelectionPaths();
/* <-MISALIGNED-> */ /* 874*/        if(!EmptyUtil.isEmpty(paths))
    {
/* <-MISALIGNED-> */ /* 875*/            int i = 0;
/* <-MISALIGNED-> */ /* 875*/            for(int n = paths.length; i < n; i++)
/* <-MISALIGNED-> */ /* 876*/                innerAcctColl.addCollection(getLeafInnerAccounts(paths[i]));
    }
/* <-MISALIGNED-> */ /* 879*/        return innerAcctColl;
}
protected InnerAccountCollection getAllInnerAccounts()
{
/* <-MISALIGNED-> */ /* 883*/        InnerAccountCollection innerAcctColl = new InnerAccountCollection();
/* <-MISALIGNED-> */ /* 884*/        TreeModel model = treeList.getModel();
/* <-MISALIGNED-> */ /* 886*/        int i = 0;
/* <-MISALIGNED-> */ /* 886*/        for(int n = model.getChildCount(model.getRoot()); i < n; i++)
    {
/* <-MISALIGNED-> */ /* 887*/            Object childNode = model.getChild(model.getRoot(), i);
/* <-MISALIGNED-> */ /* 888*/            innerAcctColl.addCollection(getLeafInnerAccounts(null, (DefaultKingdeeTreeNode)childNode));
    }
/* <-MISALIGNED-> */ /* 891*/        return innerAcctColl;
}
protected void initMultiPrint()
    throws FSException
{
/* <-MISALIGNED-> */ /* 896*/        multiPrint = new MultiPrint(this);
/* <-MISALIGNED-> */ /* 897*/        multiPrint.getMultiPrintModel().getManager().setParent(this);
/* <-MISALIGNED-> */ /* 899*/        multiPrint.setFrugalPrint(!isPaging);
/* <-MISALIGNED-> */ /* 900*/        if(isPaging)
/* <-MISALIGNED-> */ /* 903*/            tablePrint.getPrintManager().setBodyTopMargin(360F);
/* <-MISALIGNED-> */ /* 905*/        multiPrint.setTable(tablePrint);
    final InnerAccountCollection innerAcctColl;
/* <-MISALIGNED-> */ /* 908*/        if(isPrintAll)
    {
/* <-MISALIGNED-> */ /* 909*/            innerAcctColl = getAllInnerAccounts();
    } else
    {
/* <-MISALIGNED-> */ /* 911*/            innerAcctColl = getSelectedInnerAccounts();
/* <-MISALIGNED-> */ /* 912*/            if(innerAcctColl.size() <= 0)
/* <-MISALIGNED-> */ /* 913*/                throw new FSException(FSException.NOTPRINTALLSELECTROW);
    }
/* <-MISALIGNED-> */ /* 917*/        int i = 0;
/* <-MISALIGNED-> */ /* 917*/        for(int n = innerAcctColl.size(); i < n; i++)
/* <-MISALIGNED-> */ /* 918*/            multiPrint.addPrintData((new Integer(i)).toString());
/* <-MISALIGNED-> */ /* 921*/        multiPrint.setRequestData(new IRequestTableData() {
        public void requestTableData(String key)
        {
/* <-MISALIGNED-> */ /* 928*/                tablePrint.removeRows();
/* <-MISALIGNED-> */ /* 929*/                tablePrint.removeColumns();
/* <-MISALIGNED-> */ /* 930*/                tablePrint.removeHeadRows();
/* <-MISALIGNED-> */ /* 933*/                int i = 0;
/* <-MISALIGNED-> */ /* 933*/                for(int n = tblMain.getColumnCount(); i < n; i++)
            {
/* <-MISALIGNED-> */ /* 934*/                    IColumn oldCol = tblMain.getColumn(i);
/* <-MISALIGNED-> */ /* 936*/                    IColumn newCol = tablePrint.addColumn();
/* <-MISALIGNED-> */ /* 937*/                    newCol.setWidth(oldCol.getWidth());
/* <-MISALIGNED-> */ /* 938*/                    newCol.setKey(oldCol.getKey());
/* <-MISALIGNED-> */ /* 939*/                    newCol.setStyleAttributes(oldCol.getStyleAttributes());
            }
/* <-MISALIGNED-> */ /* 942*/                IRow headRow = tablePrint.addHeadRow();
/* <-MISALIGNED-> */ /* 943*/                int j = 0;
/* <-MISALIGNED-> */ /* 943*/                for(int n = tablePrint.getColumnCount(); j < n; i++)
            {
/* <-MISALIGNED-> */ /* 944*/                    IColumn headCol = tablePrint.getColumn(j);
/* <-MISALIGNED-> */ /* 945*/                    String colKey = headCol.getKey();
/* <-MISALIGNED-> */ /* 946*/                    headRow.getCell(colKey).setValue(tblMain.getHeadRow(0).getCell(colKey).getValue());
            }
/* <-MISALIGNED-> */ /* 950*/                StringBuffer sb = new StringBuffer();
/* <-MISALIGNED-> */ /* 952*/                int ind = Integer.parseInt(key);
/* <-MISALIGNED-> */ /* 953*/                tablePrint.getPrintManager().setHeader(getHeader(isPaging, innerAcctColl.get(ind)));
/* <-MISALIGNED-> */ /* 955*/                sb.append(innerAcctColl.get(ind).getNumber());
/* <-MISALIGNED-> */ /* 959*/                tablePrint.getPrintManager().setFooter(getFooter());
/* <-MISALIGNED-> */ /* 961*/                try
            {
/* <-MISALIGNED-> */ /* 961*/                    fillTable(tablePrint, sb.toString());
            }
/* <-MISALIGNED-> */ /* 964*/                catch(EASBizException e)
            {
/* <-MISALIGNED-> */ /* 965*/                    handUIExceptionAndAbort(e);
            }
/* <-MISALIGNED-> */ /* 966*/                catch(BOSException e)
            {
/* <-MISALIGNED-> */ /* 967*/                    handUIExceptionAndAbort(e);
            }
/* <-MISALIGNED-> */ /* 968*/                catch(SQLException e)
            {
/* <-MISALIGNED-> */ /* 969*/                    handUIExceptionAndAbort(e);
            }
        }
        private boolean flag;
        final InnerAccountCollection val$innerAcctColl;
        final CasSubsidiaryLedgerUI this$0;
        
        {
/* <-MISALIGNED-> */ /* 926*/                this$0 = CasSubsidiaryLedgerUI.this;
/* <-MISALIGNED-> */ /* 926*/                innerAcctColl = inneraccountcollection;
///* <-MISALIGNED-> */ /* 926*/                super();
/* <-MISALIGNED-> */ /* 924*/                flag = true;
        }
}
);
}
public void checkSelected()
{
/* <-MISALIGNED-> */ /* 978*/        if(tblMain.getRowCount() == 0 || tblMain.getSelectManager().size() == 0)
{
/* <-MISALIGNED-> */ /* 980*/            MsgBox.showWarning(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_MustSelected"));
/* <-MISALIGNED-> */ /* 981*/            SysUtil.abort();
}
}

    
    private CasSubsidiaryLedgerFilterUI filterUI;
    public static final String DEFAULT_TREE_NODE = "DefaultTreeNode";
    public static final String CURRENCY = "currency";
    private static final String resourcePath1 = "com.kingdee.eas.fm.fs.FSClientResource";
    private String resourcePath;
    private static String printDateMsg = "Print_date";
    private static String printPersonMsg = "Print_person";
    private static String printPageCountMsg = "Print_pageCount";
    private boolean isPrintAll;
    private boolean isPaging;
    private MultiPrint multiPrint;
    private KDTable tablePrint;
    private Map balanceMap;
    private BankInfo clearingHouse;
    private boolean refreshTree;
    Runnable doPrint;


}